#ifndef CHARACTERCLASSESFORM_H
#define CHARACTERCLASSESFORM_H


#include "characterclassmodel.h"


#include <dtwentymodel.h>


#include <QWidget>
#include <QSplitter>
#include <QTabWidget>


/// \todo: Delegate to edit character class features, add (remove) class skills, add (remove) special abilities...

namespace Ui {
class CharacterClassesForm;
}

class CharacterClassesForm : public QWidget
{
    Q_OBJECT
    
public:

    explicit CharacterClassesForm(QWidget *parent = 0);
    ~CharacterClassesForm();

    void setModel(DTwentyModel* model);

    void addCharacterClass();


protected slots:

    void onModelAboutToBeReset();
    void onModelReset();

    void onCurrentTabChanged(int index);
    void onTabCloseRequested(int index);

    void onCustomContextMenuRequested(const QPoint &pos);

    void onRenameTab(int index, QTabWidget* tabWidgetFrom);
    void onSplitTab(int index, QTabWidget* tabWidgetFrom);
    void onMoveTab(int index, QTabWidget* tabWidgetFrom, QTabWidget* tabWidgetTo);
    void onRemoveTab(int index, QTabWidget* tabWidgetFrom);

    void onCharacterClassAdded();


private:

    int createCharacterClassTab(const QModelIndex& modelIndex);

    QModelIndex characterClassContainerIndex() const;


    Ui::CharacterClassesForm *ui;

    QSplitter* m_splitter;
    QTabWidget* m_mainTabs;

    CharacterClassModel* m_model;

};

#endif // CHARACTERCLASSESFORM_H
